package day20171229;

import java.util.Scanner;

public class Test_1_12 {
    //回文数是指将该数含有的数字逆序排列后得到的数和原数相同
    public static void main(String[] args) {
        System.out.println("请输入一个1-9999的数");
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();

        int g;
        int s;
        int b;
        int q;
        if (num > 1 && num < 9999) {
            q = num / 1000;
            b = (num % 1000) / 100;
            s = (num % 100) / 10;
            g = num % 10;

            System.out.println(q + "\t" + b + "\t" + s + "\t" + g);
            if (q != 0) {
                System.out.println("四位数");
                if (q == g && b == s) {
                    System.out.println(num + "是一个回文数");
                } else {
                    System.out.println(num + "不是回文数");
                }
            }

            else if (b != 0) {
                System.out.println("三位数");
                if (b == g) {
                    System.out.println("回文");
                }
            }
        }

    }
}

